<%@page import="java.io.OutputStream"%>
<%@page import="javax.imageio.ImageIO"%>
<%@page import="java.awt.Font"%>
<%@page import="java.awt.Color"%>
<%@page import="java.awt.Graphics2D"%>
<%@page import="java.awt.image.BufferedImage"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	BufferedImage image = new BufferedImage(80,20,BufferedImage.TYPE_INT_RGB);
	Graphics2D g = (Graphics2D)image.getGraphics();
	g.setColor(Color.WHITE);
	g.fillRect(0, 0, 80, 20);
	g.setColor(Color.BLUE);
	g.setFont(new Font(null,Font.BOLD,20));
	g.drawString(makeNum(), 0, 20);
	response.setContentType("image/jpeg");
	OutputStream os = response.getOutputStream();
	ImageIO.write(image, "jpg", os);
	out.clear();
	out = pageContext.pushBody();
%>

<%!
private String makeNum(){
        Random random = new Random();
         String num = random.nextInt(9999999)+"";
         StringBuffer sb = new StringBuffer();
         for (int i = 0; i < 7-num.length(); i++) {
             sb.append("0");
         }
         num = sb.toString()+num;
         return num;
     }
%>
